/**
 * Project: Mobile Asset Manager
 * Author: Andrey Khalzov
 * Created: 25.02.2008 21:17:35
 *
 * Copyright (c) 1999-2008 Magenta Corporation Ltd. All Rights Reserved.
 * Magenta Technology proprietary and confidential.
 * Use is subject to license terms.
 */
package com.magenta.maxoptra.dto;

import com.magenta.maxoptra.utils.Point;

import java.io.Serializable;

public class SpatialSegment implements Serializable {
    private final double longitude1;
    private final double latitude1;
    private final double longitude2;
    private final double latitude2;
    private final double ctg;

    public SpatialSegment(Point point1, Point point2) {
        this.longitude1 = point1.getLongitude();
        this.latitude1 = point1.getLatitude();
        this.longitude2 = point2.getLongitude();
        this.latitude2 = point2.getLatitude();
        this.ctg = (longitude2 - longitude1) / (latitude2 - latitude1);
    }

    public SpatialSegment(double longitude1, double latitude1, double longitude2, double latitude2) {
        this.longitude1 = longitude1;
        this.latitude1 = latitude1;
        this.longitude2 = longitude2;
        this.latitude2 = latitude2;
        this.ctg = (longitude2 - longitude1) / (latitude2 - latitude1);
    }

    public double getLongitude1() {
        return longitude1;
    }

    public double getLatitude1() {
        return latitude1;
    }

    public double getLongitude2() {
        return longitude2;
    }

    public double getLatitude2() {
        return latitude2;
    }

    public double getCtg() {
        return ctg;
    }
}
